package com.yohann.designPattern.adapter.objectAdapter;

import com.yohann.designPattern.adapter.classAdapter.Voltage220V;
import com.yohann.designPattern.adapter.classAdapter.Voltage5V;

/**
 * <p>
 * 对象适配器
 * </p>
 *
 * @author Yohann
 * @since 2021/2/2 20:56
 */
public class ObjectAdapter implements Voltage5V {
    private Voltage220V voltage220V;

    public ObjectAdapter(Voltage220V voltage220V) {
        this.voltage220V = voltage220V;
    }

    @Override
    public int output5V() {
        int source = this.voltage220V.output220V();

        //进行适配
        return source / 44;
    }
}